Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

just-clone

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-clone

deep copies objects and arrays

  • 6.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
143K
increased by3.71%
Maintainers
1
Weekly downloads
 
Created

What is just-clone?

The just-clone npm package is a utility for deep cloning JavaScript objects. It allows you to create a deep copy of an object, ensuring that nested objects and arrays are also cloned rather than referenced.

What are just-clone's main functionalities?

Deep Cloning of Objects

This feature allows you to create a deep copy of an object, ensuring that nested objects are also cloned.

const clone = require('just-clone');
const original = { a: 1, b: { c: 2 } };
const copied = clone(original);
console.log(copied); // { a: 1, b: { c: 2 } }

Deep Cloning of Arrays

This feature allows you to create a deep copy of an array, ensuring that nested arrays are also cloned.

const clone = require('just-clone');
const original = [1, [2, 3], 4];
const copied = clone(original);
console.log(copied); // [1, [2, 3], 4]

Handling of Complex Data Types

This feature ensures that complex data types like Date, RegExp, and Map are properly cloned.

const clone = require('just-clone');
const original = { a: new Date(), b: /regex/, c: new Map([[1, 'one']]) };
const copied = clone(original);
console.log(copied); // { a: Date, b: /regex/, c: Map(1) { 1 => 'one' } }

Other packages similar to just-clone

Keywords

FAQs

Package last updated on 17 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc